/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bgIntlgn.client.entity.dictionary;

import yuhuibear.poat.annotations.action.AutoGenerateValue;
import yuhuibear.poat.annotations.relation.Field;
import yuhuibear.poat.annotations.relation.Table;
import yuhuibear.poat.object.bean.Bean;

/**
 *对应于数据字典表
 * 
 * @author shenzhang
 */
@Table(name = "dictionarys", constrain = "")
public class Dictionary implements Bean {

	@AutoGenerateValue(skipOnNull = true, sqlToGet = "select currval('dictionarys_id_seq')")
	@Field(name = "id", type = "bigserial", constrain = "primary key")
	Long id;

	/**
	 * 参考 Dictionary_type.name的外键
	 */
	@Field(name = "type", type = "char(40)", constrain = "references dictionary_types(name) on update cascade ")
	String type;

	/**
	 * 同类的排序字段。
	 */
	@Field(name = "position", type = "int", constrain = "")
	private int position;

	@Field(name = "name ", type = "varchar(128)", constrain = "")
	private String name;

	@Field(name = "value", type = "varchar(128)", constrain = "")
	private String value;

	public int hashCode() {
		return (int) (id * 1000 + name.hashCode() + value.hashCode());
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	/**
	 * 是否修改
	 */
	@Field(name = "modify", type = "boolean", constrain = "default true")
	private boolean modify;

	public boolean isModify() {
		return this.modify;
	}

	public void setModify(boolean modify) {
		this.modify = modify;
	}

	public String toString() {
		return "[" + id + ", " + type + ", " + name + ", " + position + "]";
	}

	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getType() {
		return this.type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public int getPosition() {
		return this.position;
	}

	public void setPosition(int position) {
		this.position = position;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}
}
